package model

import (
	"errors"
	"fmt"
	"github.com/doujunyu/gogo/sql_aid"
)

//用户资产

const TableByUserProperty = "self_user_property"


// UserPropertyByUser 用户资产
func UserPropertyByUser(userId int64) (map[string]interface{},error) {
	userSql, args := sql_aid.PgTable(TableByUserProperty).Where("user_id = ?", userId).ToSql()
	userData, err := sql_aid.DataToMap(PgSql.Query(userSql, args...))
	if err != nil {
		return nil,err
	}
	if len(userData) == 0 {
		return nil,errors.New(fmt.Sprintf("id = %v的用户没有资产信息"))
	}
	return userData[0],nil
}

